using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace WeberTimeTracker.Models.Mapping
{
    public class UserMap : EntityTypeConfiguration<User>
    {
        public UserMap()
        {
            // Primary Key
            this.HasKey(t => t.User_ID);

            // Properties
            this.Property(t => t.First_Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Last_Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Password)
                .IsRequired()
                .HasMaxLength(16);

            // Table & Column Mappings
            this.ToTable("Users");
            this.Property(t => t.User_ID).HasColumnName("User_ID");
            this.Property(t => t.First_Name).HasColumnName("First_Name");
            this.Property(t => t.Last_Name).HasColumnName("Last_Name");
            this.Property(t => t.Password).HasColumnName("Password");
            this.Property(t => t.Manager).HasColumnName("Manager");
        }
    }
}
